package com.room.service;

import com.room.mapper.VisitMapper;
import com.room.pojo.Teachaer;
import com.room.pojo.Visit;
import com.room.pojo.vo.VisitVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @创建人 lin
 * @创建时间 2019/10/16
 * @描述
 */
@Service
public class VisitService {
    @Autowired
    VisitMapper visitMapper ;

    //通过房间号查询访客数据
    public  List<Visit>  getVisitByRoom(String bedroomName){
        return visitMapper.getVisitByRoom(bedroomName);
    }

    //添加访客
    public int insertVisit(Visit visit){
        return visitMapper.insert(visit);
    }

    //修改访客信息
    public int updateVisit(Visit visit){
        return visitMapper.updateByPrimaryKey(visit);
    }


    //根据传进的id删除访客·数据
    public boolean deleteVisitById(String ids){
        String[] split = ids.split(",");
        return visitMapper.deleteVisitById(split) == split.length;
    }

//查询学生数据
    public List<Visit> getVisitByPage(Integer page,Integer size){
        int start = (page-1)*size;
        return visitMapper.getVisitByPage(start,size);
    }
 public long getTotal(){
        return visitMapper.getTotal();
 }

}
